var CB;
(function (CB) {
    var AI;
    (function (AI) {
        function preferencialSkillOrder(e) {
            var unit = e.unit;
            var friends = e.friends;
            var enemies = e.enemies;
            var out = { handled: false, didSomething: false };
            var flagValue = unit.ScriptFlags.get("ai_skill_useage_preference_order");
            var skillsInOrder = flagValue.split(',');
            var useableSkills = shared.GetUseableSkills(unit);
            for (var index = 0; index < skillsInOrder.length; index++) {
                var skillName = skillsInOrder[index];
                var foundSkill = findSkillInUseableSkills(useableSkills, skillName);
                if (!foundSkill)
                    continue;
            }
            return out;
        }
        AI.preferencialSkillOrder = preferencialSkillOrder;
        function findSkillInUseableSkills(useableSkills, skillName) {
            if (useableSkills.length == 0)
                return null;
            for (var index = 0; index < useableSkills.length; index++) {
                var skill = useableSkills[index];
                if (skill.IndexedName == skillName)
                    return skill;
            }
            return null;
        }
    })(AI = CB.AI || (CB.AI = {}));
})(CB || (CB = {}));
